<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        let el = console.log;
        let set = new Set(['dushenyan', "jiajia"]) //一般定义形式
        el(set)
        // 将set转为数组
        el(Array.from(set))
        el([...set])

        // set类型数字对象进行filter判断  借助Array方法
        let setArr = new Set('1314520'); //相同的1被[...setArr]语法过滤掉了
        let arr = [...setArr].filter(function (value, key) {
            if (value > 3) {
                return value;
            }
        })

        el(new Set(arr))

        // 去重 借助set
        let arr1 = [1,1,2,3,4,2,43,23,23]
        arr1 = [...new Set(arr1)]
        el(arr1)   //(6) [1, 2, 3, 4, 43, 23]
    </script>
</head>

<body>

</body>

</html>